package org.leviatan.definator.core.admin;

import java.util.Collection;
import java.util.Map;

import org.leviatan.definator.core.model.Field;
import org.leviatan.definator.core.model.Record;
import org.leviatan.definator.core.model.Table;

public abstract interface DefinatorAdminService {
	
	// main loads
	///////////////////////////////////////////////////////////////////////////
	public abstract void loadConfiguration(String filePath);
	
	public abstract void saveModels();
	
	public abstract void loadModels();
	
	public abstract void loadRegister();
	
	
	// gets
	///////////////////////////////////////////////////////////////////////////
	
	public abstract Map getTableDefinitions();
	
	public abstract Map getRecordDefinitions();
	
	public abstract Map getFieldDefinitions();
	
	public abstract Collection getTablesRecordIds(String tblId);
	
	public abstract Collection getRecordsFieldIds(String recId);
	
	public abstract Table getTableModel(String aId);
	
	public abstract Record getRecordModel(String aId);
	
	public abstract Field getFieldModel(String aId);
	
	public abstract String getFieldsRecordId(String fldId);
	
	public abstract String getRecordsTableId(String recId);
	
	
	// adds & removes
	///////////////////////////////////////////////////////////////////////////
	
	public abstract Table addTableModel(Table tbl);
	
	public abstract Record addRecordModel(Record rec);
	
	public abstract Field addFieldModel(Field fld);
	
	public abstract String createNewTableModel();
	
	public abstract String createNewRecordModel();
	
	public abstract String createNewFieldModel();
	
	public abstract String createNewTableModel(String name);
	
	public abstract String createNewRecordModel(String name, String tblRef);
	
	public abstract String createNewFieldModel(String name, int length, String type, String recRef);
	
	public abstract boolean removeTableModel(String tblId);
	
	public abstract boolean removeRecordModel(String recId);
	
	public abstract boolean removeFieldModel(String fldId);
	
	
	
	// updates
	///////////////////////////////////////////////////////////////////////////
	
	public abstract boolean updateTableModel(String tblId, Table tblModel);
	
	public abstract boolean updateTableName(String tblId, String newName);
	
	public abstract boolean updateRecordModel(String recId, Record recModel);
	
	public abstract boolean updateRecordName(String recId, String newName);
	
	public abstract boolean updateFieldModel(String fldId, Field fldModel);
	
	public abstract boolean updateFieldName(String fldId, String newName);
	
	public abstract boolean updateFieldType(String fldId, String newType);
	
	public abstract boolean updateFieldLength(String fldId, int newLength);
	
	public abstract boolean updateFieldRecordRef(String fldId, String newRef);
	
	public abstract boolean updateFieldModel(String fldId, String newName, 
			int newLength, String newType, String newRef);

}
